<!--
	导入学生页面
-->
<template>
<div class="import-box">
	<div class="top">
		<el-button type="primary" @click="downExample">下载示例</el-button>
	</div>
	<div class="bottom">
		<el-upload
			class="upload-demo"
			drag
			name="importUserFile"
			multiple
			:accept="['.xls','.xlsx']"
			:action="uploadImportUserFilePath"
			:on-success="uploadImportUserFileSuccess"
		>
			<el-icon class="el-icon--upload"><upload-filled /></el-icon>
			<div class="el-upload__text">
				拖拽文件或者 <em>点击上传</em>
			</div>
			<template #tip>
				<div class="el-upload__tip">
					仅excel文件，大小小于5M
				</div>
			</template>
		</el-upload>
	</div>
</div>
</template>

<script>
import ipconfig from "@/utils/ipconfig";
import axios from "@/plugins/axios"
import {ElMessage} from "element-plus";

export default {
	name: "ImportUser",
	data(){
		return{
			uploadImportUserFilePath:ipconfig.address+'/file/importUser',
		}
	},
	methods:{
		/**
		 * 下载示例
		 */
		downExample(){
			window.open(ipconfig.address+"/file/importExample");
		},
		uploadImportUserFileSuccess(response, file, fileList){
			ElMessage.success("添加成功");
			location.reload();
			console.log(response);
		}
	}
}
</script>

<style lang="scss" scoped>
.import-box{
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;

	.top{
		width: 100%;
		display: flex;
	}

	.bottom{
		width: 100%;
		margin-top: 20px;
		display: flex;
		justify-content: center;
	}
}
</style>